package ExceptionTest;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class Test072 {
    public static void main(String[] args) {
        try {
            readFile("d://a.txt");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    public static void readFile(String path) throws Exception{
        FileReader reader = null;
        try {
            reader = new FileReader(path);
            char c= (char) reader.read();
            char c2= (char) reader.read();
            System.out.println(""+c+c2);
        }finally {
            try {
                //关闭资源
                if (reader != null){
                    reader.close();
                }
            }catch (Exception e){
                e.printStackTrace();
            }
        }
    }
}
